package ys.ewp.dto;

import java.util.Date;

import ys.ewp.po.Comment;

public class CommentDto {
	
	private Integer id;
	//评论内容
	private String content;
	//评论者
	private Integer empId;
	//评论者姓名
	private String empRealName;
	//所评论的公告
	private Integer notId;
	//创建时间
	private Date dateCreated;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Integer getEmpId() {
		return empId;
	}
	public void setEmpId(Integer empId) {
		this.empId = empId;
	}
	public String getEmpRealName() {
		return empRealName;
	}
	public void setEmpRealName(String empRealName) {
		this.empRealName = empRealName;
	}
	public Integer getNotId() {
		return notId;
	}
	public void setNotId(Integer notId) {
		this.notId = notId;
	}
	public Date getDateCreated() {
		return dateCreated;
	}
	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}
	
	/**
	 * @功能 根据公告PO对象获得公告DTO对象
	 */
	public static CommentDto getDtoByPo(Comment com){
		CommentDto comDto = new CommentDto();
		
		comDto.setId(com.getId());
		comDto.setContent(com.getContent());
		comDto.setEmpId(com.getEmployee().getId());
		comDto.setEmpRealName(com.getEmployee().getRealName());
		comDto.setNotId(com.getNotice().getId());
		comDto.setDateCreated(com.getDateCreated());
		
		return comDto;
	}
	
	/**
	 * @功能 根据公告DTO对象获得公告PO对象
	 */
	public static Comment getPoByDto(CommentDto comDto){
		Comment com = new Comment();
		
		com.setContent(comDto.getContent());
		com.setDateCreated(comDto.getDateCreated());
		
		return com;
	}
	
}
